home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-28 | 27.1 KB | 1,134 lines |
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/Changelog,v
- retrieving revision 1.11
- diff -c -r1.11 Changelog
- *** 1.11 1992/08/14 17:19:16
- --- Changelog 1993/03/29 03:36:26
- ***************
- *** 72,74 ****
- --- 72,81 ----
- clean up binary seach conditions in val_to_sym.
-
- ------------------------------- Patchlevel 9 ---------------------------
- +
- + gprof.c: andreas
- + Handle both st-out and gnu-out (from sym-ld) format.
- +
- + cplusdem.c: andreas
- + update
- + ------------------------------- Patchlevel 10 ---------------------------
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/PatchLev.h,v
- retrieving revision 1.11
- diff -c -r1.11 PatchLev.h
- *** 1.11 1992/08/14 17:19:16
- --- PatchLev.h 1993/03/29 03:36:27
- ***************
- *** 1,4 ****
- ! #define PatchLevel "09"
-
- /*
- * the Patch Level above is to identify the version
- --- 1,4 ----
- ! #define PatchLevel "10"
-
- /*
- * the Patch Level above is to identify the version
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/cplusdem.c,v
- retrieving revision 1.3
- diff -c -r1.3 cplusdem.c
- *** 1.3 1992/06/11 17:51:35
- --- cplusdem.c 1993/03/29 03:36:30
- ***************
- *** 23,29 ****
-
- Modified for g++ 1.90.06 (December 31 version).
-
- ! Modified for g++ 1.95.03 (November 13 verison). */
-
- /* This file exports one function
-
- --- 23,29 ----
-
- Modified for g++ 1.90.06 (December 31 version).
-
- ! Modified for g++ 1.95.03 (November 13 version). */
-
- /* This file exports one function
-
- ***************
- *** 148,154 ****
- "co", "~", /* ansi */
- "call", "()", /* old */
- "cl", "()", /* ansi */
- - "cond", "?:", /* old */
- "alshift", "<<", /* old */
- "ls", "<<", /* ansi */
- "als", "<<=", /* ansi */
- --- 148,153 ----
- ***************
- *** 172,177 ****
- --- 171,177 ----
- "mx", ">?", /* psuedo-ansi */
- "min", "<?", /* old */
- "mn", "<?", /* psuedo-ansi */
- + "rm", "->*", /* ansi */
- };
-
- /* Beware: these aren't '\0' terminated. */
- ***************
- *** 235,240 ****
- --- 235,242 ----
- {
- int n = 0, success = 1;;
-
- + if (!isdigit (**type))
- + return 0;
- do
- {
- n *= 10;
- ***************
- *** 274,292 ****
- if (*type++ != '_')
- return NULL;
- #endif
- ! p = type;
- ! while (*p != '\0' && !(*p == '_' && p[1] == '_'))
- ! p++;
- ! if (*p == '\0')
- {
- ! /* destructor */
- ! if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
- {
- ! destructor = 1;
- ! p = type;
- }
- ! /* virtual table "_vt$" */
- ! else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
- {
- int n = strlen (type + 4) + 14 + 1;
- char *tem = (char *) xmalloc (n);
- --- 276,312 ----
- if (*type++ != '_')
- return NULL;
- #endif
- ! /* destructor */
- ! if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
- ! {
- ! destructor = 1;
- ! p = type;
- ! }
- ! /* virtual table "_vt$" */
- ! else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
- {
- ! if (isdigit (type[4]))
- {
- ! int n;
- ! string_init (&decl);
- ! type += 4;
- ! while (get_simple_count (&type, &n))
- ! {
- ! string_appendn (&decl, type, n);
- ! type += n;
- ! if (*type == '\0')
- ! {
- ! string_appendn (&decl, " virtual table", 15);
- ! return decl.b;
- ! }
- ! if (*type++ != CPLUS_MARKER)
- ! break;
- ! string_append (&decl, "::");
- ! }
- ! string_delete (&decl);
- ! return NULL;
- }
- ! else
- {
- int n = strlen (type + 4) + 14 + 1;
- char *tem = (char *) xmalloc (n);
- ***************
- *** 294,313 ****
- strcat (tem, " virtual table");
- return tem;
- }
- ! /* static data member */
- ! else if (type[0] == '_' && type[1] != '_' && (strchr (type, CPLUS_MARKER) != NULL))
- ! {
- ! static_type = 1;
- ! p = type + 1;
- ! }
- ! else return NULL;
- }
-
- string_init (&decl);
-
- if (static_type)
- {
- ! if (!isdigit (p[0]) && ('t' != p[0]))
- {
- string_delete (&decl);
- return NULL;
- --- 314,341 ----
- strcat (tem, " virtual table");
- return tem;
- }
- ! }
- ! /* static data member */
- ! else if (type[0] == '_' && strchr ("0123456789Qt", type[1] != '_') != NULL
- ! && strchr (type, CPLUS_MARKER) != NULL)
- ! {
- ! static_type = 1;
- ! p = type + 1;
- }
- + else
- + {
- + p = type;
- + while (*p != '\0' && !(*p == '_' && p[1] == '_'))
- + p++;
- + if (*p == '\0')
- + return NULL;
- + }
-
- string_init (&decl);
-
- if (static_type)
- {
- ! if (!isdigit (p[0]) && ('t' != p[0]) && p[0] != 'Q')
- {
- string_delete (&decl);
- return NULL;
- ***************
- *** 315,321 ****
- }
- else if (destructor)
- {
- ! if (!isdigit (p[3])&& ('t' != p[3]))
- {
- string_delete (&decl);
- return NULL;
- --- 343,349 ----
- }
- else if (destructor)
- {
- ! if (!isdigit (p[3])&& ('t' != p[3]) && p[3] != 'Q')
- {
- string_delete (&decl);
- return NULL;
- ***************
- *** 324,330 ****
- }
- else if (p == type)
- {
- ! if (!isdigit (p[2]) && ('t' != p[2]))
- {
- p += 1;
- while (*p != '\0' && !(*p == '_' && p[1] == '_'))
- --- 352,358 ----
- }
- else if (p == type)
- {
- ! if (!isdigit (p[2]) && ('t' != p[2]) && p[2] != 'Q')
- {
- p += 1;
- while (*p != '\0' && !(*p == '_' && p[1] == '_'))
- ***************
- *** 345,351 ****
- else
- {
- string_appendn (&decl, type, p - type);
- ! decl.p[0] = '0';
- munge_function_name (&decl);
- p += 2;
- }
- --- 373,379 ----
- else
- {
- string_appendn (&decl, type, p - type);
- ! decl.p[0] = '\0';
- munge_function_name (&decl);
- p += 2;
- }
- ***************
- *** 451,456 ****
- --- 479,486 ----
- string_delete (&trawname);
- break;
- }
- + if (tname.p[-1] == '>')
- + string_append (&tname, " ");
- string_append (&tname, ">::");
- if (destructor)
- string_append(&tname, "~");
- ***************
- *** 556,573 ****
- int member;
- switch (**type)
- {
- - case 'Q':
- - n = (*type)[1] - '0';
- - if (n < 0 || n > 9)
- - {
- - success = 0;
- - break;
- - }
- - *type += 2;
- - while (n-- > 0)
- - do_type (type, result);
- - break;
- -
- case 'P':
- *type += 1;
- string_prepend (&decl, "*");
- --- 586,591 ----
- ***************
- *** 610,629 ****
-
- member = **type == 'M';
- *type += 1;
- ! if (!isdigit (**type))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! n = 0;
- ! do
- ! {
- ! n *= 10;
- ! n += **type - '0';
- ! *type += 1;
- ! }
- ! while (isdigit (**type));
- ! if (strlen (*type) < n)
- {
- success = 0;
- break;
- --- 628,634 ----
-
- member = **type == 'M';
- *type += 1;
- ! if (!get_simple_count (type, &n))
- {
- success = 0;
- break;
- ***************
- *** 747,752 ****
- --- 752,765 ----
- *non_empty = 1;
- string_append (result, "unsigned");
- break;
- + case 'S':
- + *type += 1;
- + if (*non_empty)
- + string_append (result, " ");
- + else
- + *non_empty = 1;
- + string_append (result, "signed");
- + break;
- case 'V':
- *type += 1;
- if (*non_empty)
- ***************
- *** 813,818 ****
- --- 826,837 ----
- string_append (result, " ");
- string_append (result, "char");
- break;
- + case 'w':
- + *type += 1;
- + if (*non_empty)
- + string_append (result, " ");
- + string_append (result, "wchar_t");
- + break;
- case 'r':
- *type += 1;
- if (*non_empty)
- ***************
- *** 883,890 ****
- if (!do_template_args (type, result))
- success = 0;
- else
- ! string_append (result, ">");
- break;
- default:
- success = 0;
- break;
- --- 902,947 ----
- if (!do_template_args (type, result))
- success = 0;
- else
- ! {
- ! if (result->p[-1] == '>')
- ! string_append (result, " ");
- ! string_append (result, ">");
- ! }
- ! break;
- ! case 'Q':
- ! n = (*type)[1] - '0';
- ! if (n < 0 || n > 9)
- ! {
- ! success = 0;
- ! break;
- ! }
- ! *type += 2;
- ! if (n > 0)
- ! {
- ! string temp;
- ! if (!do_type (type, &temp))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! if (*non_empty)
- ! string_append (result, " ");
- ! string_appends (result, &temp);
- ! string_delete (&temp);
- ! while (--n > 0)
- ! {
- ! if (!do_type (type, &temp))
- ! {
- ! success = 0;
- ! break;
- ! }
- ! string_append (result, "::");
- ! string_appends (result, &temp);
- ! string_delete (&temp);
- ! }
- ! }
- break;
- +
- default:
- success = 0;
- break;
- ***************
- *** 916,922 ****
- {
- *type += 1;
-
- ! success = do_type (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- --- 973,979 ----
- {
- *type += 1;
-
- ! success = do_arg (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- ***************
- *** 932,938 ****
- int is_integral = 0;
- int done = 0;
-
- ! success = do_type (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- --- 989,995 ----
- int is_integral = 0;
- int done = 0;
-
- ! success = do_arg (type, &temp);
- if (success)
- string_appends (result, &temp);
- string_delete(&temp);
- ***************
- *** 948,953 ****
- --- 1005,1011 ----
- done = is_pointer = 1;
- break;
- case 'C': /* const */
- + case 'S': /* explicitly signed [char] */
- case 'U': /* unsigned */
- case 'V': /* volatile */
- case 'F': /* function */
- ***************
- *** 967,972 ****
- --- 1025,1031 ----
- case 'i': /* int */
- case 's': /* short */
- case 'c': /* char */
- + case 'w': /* wchar_t */
- done = is_integral = 1;
- break;
- case 'r': /* long double */
- ***************
- *** 1039,1046 ****
- }
- need_comma = 1;
- }
- ! return success;
- !
- }
-
- /* `result' will be initialised in do_type; it will be freed on failure */
- --- 1098,1104 ----
- }
- need_comma = 1;
- }
- ! return success;
- }
-
- /* `result' will be initialised in do_type; it will be freed on failure */
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/gprof.c,v
- retrieving revision 1.9
- diff -c -r1.9 gprof.c
- *** 1.9 1992/08/14 17:19:16
- --- gprof.c 1993/03/29 03:36:31
- ***************
- *** 49,54 ****
- --- 49,56 ----
-
- #ifdef atarist
- # include <st-out.h>
- + # include <gnu-out.h>
- + # define A_OUT
- #else
- # if !defined(A_OUT) && !defined(MACH_O)
- # define A_OUT
- ***************
- *** 412,424 ****
- /* argv[0], here for the sake of error messages. */
- char *myname = 0;
-
- - /* Header of the executable file. */
- - #ifdef atarist
- - struct aexec exec_header;
- - #else
- - struct exec exec_header;
- - #endif
- -
- /* Name of the executable file. */
- char *exec_file_name;
-
- --- 414,419 ----
- ***************
- *** 429,439 ****
- char *strs;
-
- #ifdef atarist
- ! /* The maximal length of an symbol name.
- ! This is initially eight, but will be changed to 22 in the code
- if any GST compatible long symbols are detected in the symbol table.
- NOTE: do not change it manually here */
- ! int max_atari_sym_length = 8;
- #endif
-
- /* Header of the first gmon.out file we read. This is used to (try to)
- --- 424,440 ----
- char *strs;
-
- #ifdef atarist
- ! /* The maximal length of an symbol name (without leading underscore).
- ! This is initially seven, but will be changed to 21 in the code
- if any GST compatible long symbols are detected in the symbol table.
- NOTE: do not change it manually here */
- ! int max_atari_sym_length = 7;
- !
- ! /* The format of the exec file.
- ! This is set to FALSE, if the exec file is in gnu-out format as produced
- ! by sym-ld. It is checked when comparing symbols, which have limited
- ! length in the st-out format. */
- ! int atari_exec_format = TRUE;
- #endif
-
- /* Header of the first gmon.out file we read. This is used to (try to)
- ***************
- *** 634,642 ****
- /* Prototypes for all the functions. */
-
- int main EXT2(int, char **);
- - #ifndef atarist
- int read_header_info EXT6 (char *, FILE *, long int *, unsigned int *,
- long int *, unsigned int *);
- #endif
- void print_flat_profile EXT0();
- void print_call_graph EXT0();
- --- 635,645 ----
- /* Prototypes for all the functions. */
-
- int main EXT2(int, char **);
- int read_header_info EXT6 (char *, FILE *, long int *, unsigned int *,
- long int *, unsigned int *);
- + #ifdef atarist
- + int atari_read_header_info EXT4 (char *, FILE *, long int *,
- + unsigned int *);
- #endif
- void print_flat_profile EXT0();
- void print_call_graph EXT0();
- ***************
- *** 653,663 ****
- struct mesym **find_funp_from_name EXT1(char *);
- struct mesym **find_funp_from_pointer EXT1(struct mesym *);
- void read_syms EXT2(FILE *, int);
- struct mesym *val_to_sym EXT1(unsigned long);
- - #ifndef atarist
- int badsym EXT1(struct nlist *);
- ! #else
- ! int badsym EXT1(struct asym *);
- #endif
- int symcmp EXT2(const void *, const void *);
- int timecmp EXT2(const void *, const void *);
- --- 656,668 ----
- struct mesym **find_funp_from_name EXT1(char *);
- struct mesym **find_funp_from_pointer EXT1(struct mesym *);
- void read_syms EXT2(FILE *, int);
- + #ifdef atarist
- + void atari_read_syms EXT2(FILE *, int);
- + #endif
- struct mesym *val_to_sym EXT1(unsigned long);
- int badsym EXT1(struct nlist *);
- ! #ifdef atarist
- ! int atari_badsym EXT1(struct asym *);
- #endif
- int symcmp EXT2(const void *, const void *);
- int timecmp EXT2(const void *, const void *);
- ***************
- *** 752,758 ****
- int argc;
- char **argv;
- int c;
- - int n;
-
- extern char *optarg;
- extern int optind, opterr;
- --- 757,762 ----
- ***************
- *** 776,790 ****
-
- char *name = '\0';
- int ind;
- - #ifndef atarist
- long int syms_offset;
- unsigned int syms_size;
- long int strs_offset;
- unsigned int strs_size;
- - #endif
-
- #ifdef atarist
- ! _malloczero(1);
- #endif
- argc=ac;
- argv=av;
- --- 780,792 ----
-
- char *name = '\0';
- int ind;
- long int syms_offset;
- unsigned int syms_size;
- long int strs_offset;
- unsigned int strs_size;
-
- #ifdef atarist
- ! /* _malloczero(1); */
- #endif
- argc=ac;
- argv=av;
- ***************
- *** 870,894 ****
- /* Open the a.out file, and read in selected portions */
- #ifdef atarist
- fp=ck_fopen (exec_file_name, "rb");
- ! ck_fread ((void *)&exec_header, sizeof (exec_header), 1, fp);
- !
- ! /* Make sure its really an a.out file. If it isn't yell and scream
- ! and stamp our feet. */
- ! if (A_BADMAG (exec_header))
- ! fatal ("`%s' is not an executable file", exec_file_name);
- !
- ! if(exec_header.a_syms == 0L)
- ! fatal ("`%s' has no symbols", exec_file_name);
- !
- ! /* Read the symbols, and put the interesting ones (sorted) in SYMS. */
- ! /* read_syms builds strs too */
- ! ck_fseek (fp, A_SYMOFF (exec_header), 0);
- ! read_syms (fp, exec_header.a_syms/sizeof (struct asym));
- !
- ! #else /* ! atarist */
- !
- ! /* Open the a.out file, and read in selected portions */
- fp=ck_fopen (exec_file_name, "r");
-
- /* Make sure its really an a.out file. If it isn't yell and scream
- and stamp our feet. */
- --- 872,893 ----
- /* Open the a.out file, and read in selected portions */
- #ifdef atarist
- fp=ck_fopen (exec_file_name, "rb");
- ! #else
- fp=ck_fopen (exec_file_name, "r");
- + #endif
- +
- + #ifdef atarist
- + if (atari_read_header_info (exec_file_name, fp, &syms_offset, &syms_size))
- + {
- + /* Read the symbols, and put the interesting ones (sorted) in SYMS. */
- + /* read_syms builds strs too */
- + ck_fseek (fp, syms_offset, 0);
- + atari_read_syms (fp, syms_size / sizeof (struct asym));
- + }
- + else
- + {
- + atari_exec_format = FALSE;
- + #endif /* atarist */
-
- /* Make sure its really an a.out file. If it isn't yell and scream
- and stamp our feet. */
- ***************
- *** 903,908 ****
- --- 902,910 ----
- /* Read the symbols, and put the interesting ones (sorted) in SYMS. */
- ck_fseek (fp, syms_offset, 0);
- read_syms (fp, syms_size / sizeof (struct nlist));
- +
- + #ifdef atarist
- + }
- #endif /* atarist */
-
- ck_fclose (fp);
- ***************
- *** 987,993 ****
- return(0);
- }
-
- - #ifndef atarist
- /* Read various information from the header of an object file.
- Return 0 for failure or 1 for success. */
-
- --- 989,994 ----
- ***************
- *** 1062,1068 ****
-
- return 0;
- }
- ! #endif /* !atarist */
-
- /* Output a summary gmon file containing all our accumulated
- histogram and call-graph data. */
- --- 1063,1092 ----
-
- return 0;
- }
- !
- ! #ifdef atarist
- ! int
- ! atari_read_header_info (name, fp, syms_offset, syms_size)
- ! char *name;
- ! FILE *fp;
- ! long int *syms_offset;
- ! unsigned int *syms_size;
- ! {
- ! struct aexec hdr;
- !
- ! ck_fseek (fp, 0L, 0);
- !
- ! if (fread ((char *) &hdr, sizeof hdr, 1, fp) == 1 && !A_BADMAG(hdr))
- ! {
- ! *syms_offset = A_SYMOFF (hdr);
- ! *syms_size = hdr.a_syms;
- ! return 1;
- ! }
- !
- ! return 0;
- ! }
- !
- ! #endif /* atarist */
-
- /* Output a summary gmon file containing all our accumulated
- histogram and call-graph data. */
- ***************
- *** 1718,1724 ****
- #ifndef atarist
- if (!strcmp (p->name, filters[n].name)) {
- #else
- ! if (!strncmp (p->name, filters[n].name, max_atari_sym_length)) {
- #endif
- tothist-=p->histo;
- break;
- --- 1742,1750 ----
- #ifndef atarist
- if (!strcmp (p->name, filters[n].name)) {
- #else
- ! if (atari_exec_format
- ! ? !strncmp (p->name, filters[n].name, max_atari_sym_length)
- ! : !strcmp (p->name, filters[n].name)) {
- #endif
- tothist-=p->histo;
- break;
- ***************
- *** 2090,2097 ****
- return 0;
- }
-
- - #ifndef atarist /* atarist specific version at end */
- -
- /* Read symbols from a.out file open on FP. There are N of them. Allocate a
- vector to store the interesting ones in, and sort it numerically. */
-
- --- 2116,2121 ----
- ***************
- *** 2130,2135 ****
- --- 2154,2165 ----
- for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
- if (!badsym (sym)) {
- syms[i].name=sym->n_un.n_name;
- +
- + #ifndef nounderscore
- + /* Remove the initial _ from the symbol name */
- + if (*(syms[i].name)=='_')
- + syms[i].name++;
- + #endif
- syms[i].value=sym->n_value;
- i++;
- }
- ***************
- *** 2144,2149 ****
- --- 2174,2253 ----
- qsort (syms, nsym, sizeof (struct mesym), symcmp);
- free ((void *)tmpsyms);
- }
- +
- + #ifdef atarist
- +
- + void
- + atari_read_syms FUN2(FILE *, fp, int, n)
- + {
- + struct asym *tmpsyms;
- + struct asym *sym;
- + char *s, *p, *q;
- + int i, j, is_long;
- +
- + /* creat space for incore name strings */
- + s = strs = ck_malloc (n*sizeof (struct asym)); /* slight overkill */
- + *s++ = 0; /* so that sym.name[-1] is always defined */
- +
- + /* Read the entire symbol table. */
- + tmpsyms=(struct asym *)ck_malloc (n*sizeof (struct asym));
- + ck_fread (tmpsyms, sizeof (struct asym), n, fp);
- +
- + /* Count the useful symbols.
- + Also relocate their name-fields to be C string pointers. */
- + for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
- + q = s;
- + for (j = 0, p = sym->n_un.a_name; (j < 8) && (*p != '\0'); j++)
- + *s++ = *p++;
- + if ((sym->a_type & A_LNAM) == A_LNAM) {
- + max_atari_sym_length = 21;
- + is_long = TRUE;
- + if (sym + 1 < &tmpsyms[n]) {
- + for (j = 0, p = sym[1].n_un.a_name; j < 14 && *p != '\0'; j++)
- + *s++ = *p++;
- + }
- + else
- + /* there's something wrong; assume short symbol */
- + is_long = FALSE;
- + }
- + else
- + is_long = FALSE;
- + *s++ = '\0';
- + sym->n_un.ptr = q;
- + if (atari_badsym (sym))
- + sym->n_un.ptr = NULL;
- + else
- + i++;
- + if (is_long)
- + /* skip symbol name extension */
- + (++sym)->n_un.ptr = NULL;
- + }
- +
- + /* Allocate permanent space and copy useful symbols into it. */
- + nsym=i;
- + syms=(struct mesym *)ck_calloc (nsym, sizeof (struct mesym));
- +
- + for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
- + if (sym->n_un.ptr != NULL) {
- + syms[i].name=sym->n_un.ptr;
- +
- + #ifndef nounderscore
- + /* Remove the initial _ from the symbol name */
- + if (*(syms[i].name)=='_')
- + syms[i].name++;
- + #endif
- + syms[i].value=sym->a_value;
- + i++;
- + }
- + }
- +
- + if (i != nsym)
- + exit (96);
- +
- + /* Put symbols in numeric order. */
- + qsort (syms, nsym, sizeof (struct mesym), symcmp);
- + free ((void *)tmpsyms);
- + }
- #endif /* atarist */
-
- /* Return the symbol which has the largest value less than or equal to VAL.
- ***************
- *** 2177,2183 ****
- return m;
- }
-
- - #ifndef atarist
- /* Return TRUE if the nlist-entry SYM describes a symbol
- that gprof should NOT pay attention to. */
-
- --- 2281,2286 ----
- ***************
- *** 2193,2199 ****
- return TRUE;
- #endif
- local = !(sym->n_type&N_EXT);
- ! if (no_locals && !local)
- return TRUE;
- /* Filenames or pascal labels should be ignored */
- if (local
- --- 2296,2302 ----
- return TRUE;
- #endif
- local = !(sym->n_type&N_EXT);
- ! if (no_locals && local)
- return TRUE;
- /* Filenames or pascal labels should be ignored */
- if (local
- ***************
- *** 2206,2212 ****
- --- 2309,2342 ----
- return TRUE;
- return FALSE;
- }
- +
- + #ifdef atarist
- +
- + /* Return TRUE if the asym-entry SYM describes a symbol
- + that gprof should NOT pay attention to. */
- +
- + int
- + atari_badsym FUN1(struct asym *, sym)
- + {
- + int local;
- + if (!(sym->a_type & A_TEXT))
- + return TRUE;
- + local = !(sym->a_type & A_GLOBL);
- + if (no_locals && local)
- + return TRUE;
- + /* Filenames or pascal labels should be ignored */
- + if (local
- + && (index (sym->n_un.ptr, '.') || index (sym->n_un.ptr, '$')
- + || index (sym->n_un.ptr, '/') || index (sym->n_un.ptr, '\\')
- + || index (sym->n_un.ptr, ':')
- + #ifndef nounderscore
- + || sym->n_un.ptr[0] != '_'
- #endif
- + ))
- + return TRUE;
- + return FALSE;
- + }
- + #endif /* atarist */
-
- /* This is used to qsort () the symbol table into numerical order. */
-
- ***************
- *** 2829,2846 ****
-
- n=0;
- for (np=syms, endp= &syms[nsym]; np<endp; np++) {
- - char *demangled = cplus_demangle (np->name);
- - char *name;
- -
- - if (demangled)
- - name = demangled;
- - else {
- - name = np->name;
- #ifndef nounderscore
- ! if (*name == '_')
- ! name++;
- #endif
- ! }
-
- sprintf (buf, "%-15s %#6lx %d %2d.%2d[%d]",
- name, np->value, np->histo, np->ncalled, np->ncalls, np->cycnum);
- --- 2959,2971 ----
-
- n=0;
- for (np=syms, endp= &syms[nsym]; np<endp; np++) {
- #ifndef nounderscore
- ! char *demangled = cplus_demangle (np->name);
- ! #else
- ! char *demangled =
- ! cplus_demangle (np->name[-1] == '_' ? np->name-1 : np->name);
- #endif
- ! char *name = demangled == NULL ? np->name : demangled;
-
- sprintf (buf, "%-15s %#6lx %d %2d.%2d[%d]",
- name, np->value, np->histo, np->ncalled, np->ncalls, np->cycnum);
- ***************
- *** 2877,2991 ****
- }
- }
-
- - #ifdef atarist /* atariSt specific versions */
- -
- - /* Return TRUE if the asym-entry SYM describes a symbol
- - that gprof should NOT pay attention to. */
- -
- - #define ISDRIVE(d) ( \
- - (((d) >= 'A') && ((d) <= 'Z')) || \
- - (((d) >= 'a') && ((d) <= 'z')) )
- - int
- - badsym FUN1(struct asym *, sym)
- - {
- - if(sym->a_type == A_UNDF)
- - return TRUE; /* these are the symbols ld (write_atari_sym()) had faked */
- - if (!(sym->a_type & A_TEXT))
- - return TRUE;
- - if (no_locals && !(sym->a_type & A_GLOBL))
- - return TRUE;
- - if(!strncmp(sym->n_un.ptr, "gcc_comp", 8L))
- - return TRUE;
- - if(ISDRIVE((sym->n_un.ptr)[0]) && ((sym->n_un.ptr)[1] == ':'))
- - return TRUE;
- - /* Filenames or pascal labels should be ignored */
- - if (index (sym->n_un.ptr, '.') || index (sym->n_un.ptr, '$') ||
- - index (sym->n_un.ptr, '/') || index (sym->n_un.ptr, '\\') )
- - return TRUE;
- - return FALSE;
- - }
- -
- - /* Read symbols from a.out file open on FP. There are N of them. Allocate a
- - vector to store the interesting ones in, and sort it numerically. */
- -
- - void
- - read_syms FUN2(FILE *, fp, int, n)
- - {
- - struct asym *tmpsyms;
- - char *s, *p, *q;
- - int i,j,is_long;
- -
- - /* creat space for incore name strings */
- - s = strs = ck_malloc(n*25); /* slight overkill */
- -
- - /* Read the entire symbol table. */
- - tmpsyms=(struct asym *)ck_malloc (n*sizeof (struct asym));
- - ck_fread (tmpsyms, sizeof (struct asym), n, fp);
- -
- -
- - /* Count the useful symbols.
- - Also relocate their name-fields to be C string pointers. */
- - for(nsym = 0, i = 0; i < n; i++)
- - {
- - for(j = 0, p = &(tmpsyms[i].n_un.a_name[0]), q = s;
- - (j < 8) && (*p != '\0'); j++)
- - *s++ = *p++;
- - if ((tmpsyms[i].a_type & A_LNAM) == A_LNAM)
- - {
- - max_atari_sym_length = 22;
- - is_long = TRUE;
- - if (i + 1 < n)
- - for (j = 0, p = &tmpsyms[i+1].n_un.a_name[0];
- - j < 14 && *p != '\0'; j++)
- - *s++ = *p++;
- - else
- - /* there's something wrong; assume short symbol */
- - is_long = FALSE;
- - }
- - else
- - is_long = FALSE;
- - *s++ = '\0';
- - tmpsyms[i].n_un.ptr = q;
- - if (badsym (&tmpsyms[i]))
- - {
- - tmpsyms[i].n_un.ptr = (char *)0;
- - }
- - else
- - {
- - nsym++;
- - }
- - if (is_long)
- - /* skip symbol name extension */
- - tmpsyms[++i].n_un.ptr = NULL;
- - }
- -
- - /* Allocate permanent space and copy useful symbols into it. */
- - syms=(struct mesym *)ck_calloc (nsym, sizeof (struct mesym));
- -
- - for (i=0, j = 0; i < n; i++) {
- - if (tmpsyms[i].n_un.ptr != (char *)0) {
- - syms[j].name = tmpsyms[i].n_un.ptr;
- - /* #ifndef nounderscore */
- - #if 0
- - /* Remove the initial _ from the symbol name */
- - if (*(syms[j].name)=='_')
- - syms[j].name++;
- - #endif
- - syms[j].value = tmpsyms[i].a_value;
- - j++;
- - }
- - }
- -
- - if (j != nsym)
- - exit (99);
- -
- - free ((void *)tmpsyms);
- -
- - /* Put symbols in numeric order. */
- - qsort (syms, nsym, sizeof (struct mesym), symcmp);
- - }
- - #endif /* atarist */
- -
- void print_version FUN0()
- {
- #ifdef atarist
- --- 3002,3007 ----
- ***************
- *** 3018,3046 ****
- void
- fprint_name FUN2(FILE *, stream, char *, name)
- {
- char *demangled = cplus_demangle (name);
- ! if (demangled == NULL)
- ! {
- ! #ifndef nounderscore
- ! if (*name == '_')
- ! name++;
- #endif
- ! fputs (name, stream);
- ! }
- else
- {
- fputs (demangled, stream);
- free (demangled);
- }
- }
- -
- - #if 0
- - /* let this be dummy for now,
- - if you want to throw in the cplusplus name demangler, simple
- - delete this function, and link with cplus-dem.o
- - */
- - char *cplus_demangle FUN1(char *, name)
- - {
- - return NULL;
- - }
- - #endif
- --- 3034,3049 ----
- void
- fprint_name FUN2(FILE *, stream, char *, name)
- {
- + #ifdef nounderscore
- char *demangled = cplus_demangle (name);
- ! #else
- ! char *demangled = cplus_demangle (name[-1] == '_' ? name-1 : name);
- #endif
- ! if (demangled == NULL)
- ! fputs (name, stream);
- else
- {
- fputs (demangled, stream);
- free (demangled);
- }
- }
-